#include "node.h"

Node::Node(Pattern *p){
    this->p = p;
    p->addChild(this);
    next = p->getAcceptNode();
}

bool GroupTail::match(Matcher *m, size_t from, const string &text){
    int save_last_to = m->capture_groups[g->group_index].to;
    g->markTo(m,from-1);
    if(g->next->match(m,from,text)){
        return true;
    } else {
        g->markTo(m,save_last_to);
        return false;
    }
}
